package com.kingsoft.dc.khaos.module

import com.kingsoft.dc.khaos.{DataSetChannel, KhaosConf, KhaosContext, SchemaChannel}
import com.kingsoft.dc.khaos.metadata.Dependency

/**
  * Created by chengguangqing on 2019/6/2.
  */
trait TModule {

  //type DataSet
  var dependencies: Seq[Dependency]
  var targets:Seq[Dependency]

  /**
    * 获取trans的信赖
    *
    * @return
    */
  def getDependencies(): Seq[Dependency] = dependencies

  /**
    * 添加trans的信赖
    *
    * @param dependency : 依赖信息，每个组件的唯一组件
    */
  def addDependencies(dependency: Dependency): Any

  /**
    *
    * 节点逻辑处理的准备信息
    *
    * @param dittoConf : 组件配置信息
    * @param kc        : 组件上下文环境
    */
  def prepare(dittoConf: KhaosConf, kc: KhaosContext): Any

  /**
    * 节点执行逻辑
    *
    * @param dataCollector :  数据采集器
    */
  def execute(dataCollector: DataSetChannel): Any

  /**
    * 声明输出schema
    *
    * @param declarer :  输出声明器
    */
  def declareOutputSchema(declarer: SchemaChannel): Any

  /**
    * 获取配置信息
    *
    * @return :  返回配置信息
    */
  def getModuleConfiguration(): Option[String]

  /**
    * 清除组件相关信息
    */
  def cleanup()

}
